<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<script>
    var arr=([1,2,3,4,2,5,2,6,2,7,2]);
    console.log('原数组：'+arr);
    var newarr=[];
    var index=0;
    for(var i in arr){
        if(arr[i]!==2){
            newarr[index]=arr[i];
            ++index;
        }
    }
</script>
</body>
</html>